home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Tools & Apps / Misc. Utilities / Installer 3.4 / Examples - Installer 3.4 / Action Atom Samples / Lock File Installer AA Sample / SetLockBitAtomSample.r < prev   
Encoding:
Text File  |  1992-09-21  |  5.4 KB  |  162 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2.  *
  3.  *    Apple Macintosh Developer Technical Support
  4.  *
  5.  *  Installer 3.4 sample: Action Atoms
  6.  *
  7.  *    File:        SetLockBitAtomSample.r -    Rez Source
  8.  *
  9.  *    by:            Rich Kubota
  10.  *
  11.  *    Copyright © 1992 Apple Computer, Inc.
  12.  *    All rights reserved.
  13.  *
  14.  *------------------------------------------------------------------------------
  15.  *
  16.  * Install application "TheProgram" into the "Root directory and lock the file.
  17.  * For this sample, I use TeachText as the program to install and lock.
  18.  * Demonstrates implementation of an action atom.
  19.  *
  20.  * Note: This action atom sample is only compatible with Installer 3.3 and 3.4
  21.  *----------------------------------------------------------------------------*/
  22. /*
  23.  
  24. You can build the script with the following lines:
  25.  
  26.         rez  -o "SetLockBitAtomSample" -t 'bbkr' -c 'bbkr' "SetLockBitAtomSample.r"
  27.         setfile -a i "SetLockBitAtomSample"
  28.         scriptcheck -p "SetLockBitAtomSample"
  29.  
  30. ------------------------------------------------------------------------------------------
  31. */
  32.  
  33. #include "Types.r"
  34. #include "InstallerTypes.r"
  35.  
  36. /* 'inaa' code resource definition */
  37. #define        aaCodeID            10000
  38.  
  39. /* put a 1 in the creation date field of source 'infs' to have ScriptCheck set date */
  40. #define kScriptCheckSetsDate    0x01
  41.  
  42. /* Definitions for the file spec atoms (specifications for source and destination files) */
  43. #define fsSourceProgram            2000
  44. #define fsTargetProgram            2001
  45.  
  46. /* This is the name of the source disk */
  47. #define ProgramDisk "Program Disk:"
  48.  
  49. /* where we want to install our file. */
  50. #define TargetPath    ":"
  51.  
  52. /* Definition for the package. */
  53. #define pkTheProgram            3000
  54.  
  55. /* Definition for the file atom */
  56. #define faProgram                4000
  57.  
  58. /* Definition for the package comment resource */
  59. #define cmtTheProgram            5000
  60.  
  61. /* Definitions for the action atom resources */
  62. #define aaSetLockBit            6000
  63.  
  64. /* June 16, 1992 is the current release date I put in 'icmt' rsrcs. ScriptCheck will convert */
  65. /* this value to a LongInt seconds value needed by the Installer. */
  66. #define currentReleaseDate        6161992        
  67. #define currentVersion            100     /* Version 1.0 goes in the 'icmt' rsrc */
  68.  
  69. #define iconTheProgram            5100
  70.  
  71. /************************** Easy Install Rule resources **********************************/
  72.  
  73. /***************************** Package Resources ************************************************/
  74. resource 'inpk' (pkTheProgram) {
  75.     format0 {
  76.         ShowsOnCustom,                 /* Package appears in the Custom Install display */
  77.         Removable,                    /* Package can be removed */
  78.         dontForceRestart,            /* no need to restart */
  79.         cmtTheProgram,                 /* package's 'icmt' resource id */
  80.         0,                            /* Package size (filled in by ScriptCheck) */
  81.         "TheProgram", {                /* package name for package that shows on custom */
  82.             'infa', faProgram;
  83.             'inaa', aaSetLockBit;
  84.         }
  85.     }
  86. };
  87.  
  88. /***************************** Comments ************************************************/
  89. resource 'icmt' (cmtTheProgram) {
  90.     currentReleaseDate,
  91.     currentVersion,
  92.     iconTheProgram,
  93.     "This package contains TheProgram. "
  94. };
  95.  
  96. resource 'ICON' (iconTheProgram) {
  97.         $"0430 4000 0A50 A000 0B91 1002 0822 0803"
  98.         $"1224 0405 2028 0209 4010 0111 800C 00A1"
  99.         $"8003 FFC2 7E00 FF04 0100 7F04 0300 1E08"
  100.         $"04E0 000C 08E0 000A 10E0 0009 08C0 0006"
  101.         $"0487 FE04 0288 0104 0188 0084 0088 0044"
  102.         $"0088 0044 0088 00C4 0110 0188 0228 0310"
  103.         $"01C4 04E0 0002 0800 73BF FBEE 4CA2 8A2A"
  104.         $"40AA AAEA 52AA AA24 5EA2 8AEA 73BE FB8E",
  105. };
  106.  
  107.  
  108. /********************************************* File Specs ******************************************/
  109. /* Source File Specs */
  110. resource 'infs' (fsSourceProgram) {
  111.     'APPL',                                /* File Type */
  112.     'ttxt',                                /* Creator */
  113.     kScriptCheckSetsDate,                /* ScriptCheck fills in the creation date */
  114.     noSearchForFile,                    /* Do not search the source disk for the file */
  115.     TypeCrMustMatch,                    /* file type and creator on source disk must match */
  116.     ProgramDisk"TeachText"                /* Path to the file */
  117. };
  118.  
  119. /* Target File Specs */
  120. resource 'infs' (fsTargetProgram) {
  121.     'APPL',                                /* File Type */
  122.     'ttxt',                                /* Creator */
  123.     0,                                    /* creation date not needed for target file specs */
  124.     noSearchForFile,                    /* Do not search the target disk for the file */
  125.     TypeCrMustMatch,                    /* not needed for target file specs */
  126.     TargetPath"TeachText"                /* destination Path */
  127. };
  128.  
  129. /******************************************** File Atoms ************************************************/
  130. resource 'infa' (faProgram) {
  131.     format0 {
  132.         delRemove,                        /* Delete the file if remove (option-custom) is clicked    */
  133.         delInstall,                     /* Delete the target before copying new one */
  134.         copy,                             /* Copy the file to the destination */
  135.         leaveAloneIfNewer,                 /* do not Install this version, if newer one exists */
  136.         noKeepExisting,                 /* Always replace an existing copy */
  137.         copyIfNewOrUpdate,                /* Copy whether the target file exists or not */
  138.         rsrcFork, dataFork,                /* Copy both forks of the file */
  139.         fsTargetProgram,                /* TARGET file spec for this file */
  140.         fsSourceProgram,                 /* SOURCE file spec for this file */
  141.         0,                                /* atom size (filled in by ScriptCheck) */
  142.         ""                                /* Atom Description (Installer will use file name) */
  143.     };
  144. };
  145.  
  146.  
  147. resource 'inaa'    (aaSetLockBit) {
  148.     format1 {
  149.         continueBusyCursors,
  150.         actAfter,
  151.         dontActOnRemove,
  152.         actOnInstall,
  153.         'infn',
  154.         aaCodeID,
  155.         fsTargetProgram,                /* pass in the 'infs' resource ID of the file to lock */
  156.         "Set Locked Bit of Target file based on target infs resource ID"
  157.     }
  158. };
  159.  
  160. INCLUDE    "SetLockBit.rsrc" 'infn' (10000) AS 'infn' (aaCodeID, $$Attributes);
  161.  
  162.